package projectdemo01.book;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:咭咭熊
 * Date:2021 - 09 - 23
 * Time:19:27
 */
//书架
public class BookList {
    private Book[] books;
    private int usedSize;

    public BookList() {
        this.books = new Book[10];
        //先存放3本书
        books[0] = new Book("西游记","罗贯中",20,"小说");
        books[1] = new Book("三国演义","吴承恩",20,"小说");
        books[2] = new Book("水浒传","施耐庵",20,"小说");
        this.usedSize = 3;
    }

    public Book[] getBooks() {
        return books;
    }

    public void setBooks(Book[] books) {
        this.books = books;
    }

    public int getUsedSize() {
        return usedSize;
    }

    public void setUsedSize(int usedSize) {
        this.usedSize = usedSize;
    }

    /***
     * 1.在pos位置放入书——即尾插法实现
     * @param pos
     * @param book
     */
    public void setBooks(int pos,Book book){
        books[pos] = book;
    }

    /***
     * 2.返回pos位置的书
     * @param pos
     * @return
     */
    public Book getBook(int pos){
        return  this.books[pos];
    }
    //定义对bookList的增删查改接口
}
